package com.sugon.dao;

import com.sugon.entity.ModuleSpPurchasingBatchEntity;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 模具型芯备件采购批次信息Dao
 *
 * @author sugon
 * @date 2021-10-13 09:58:53
 */
public interface ModuleSpPurchasingBatchDao extends BaseDao<ModuleSpPurchasingBatchEntity> {

    /**
     * 找到匹配的型芯采购批次
     *
     * @param moldSpId    模具型芯ID
     * @param demandMonth 需求月份
     * @return
     */
    @Select("SELECT * FROM module_sp_purchasing_batch WHERE mold_sp_id = #{moldSpId} AND INSTR(BAR_CORD_ANALYSIS_RULE,#{demandMonth}) > 0")
    List<ModuleSpPurchasingBatchEntity> findMatchedPurchasingBatch(@Param("moldSpId") String moldSpId, @Param("demandMonth") String demandMonth);

    /**
     * 找出某一年份下所有型芯的采购记录
     *
     * @param yearly            年度
     * @param uniqueBarCodeList 型芯条码列表
     * @return
     */
    List<ModuleSpPurchasingBatchEntity> findMatchedYearlyPurchasingBatch(@Param("yearly") String yearly,@Param("uniqueBarCodeList") List<String> uniqueBarCodeList);

}
